{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">场次日期：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="goods_activity_date" lay-verify="required" placeholder="场次日期" class="layui-input test-item" value="{$goods.goods_activity_date}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">场次时间：</label>
                            <div class="layui-input-block">
                                <select name="goods_activity_time">
                                    <option value="10:00-13:00" {$goods.activity_time == '10:00-13:00' ? 'selected' : ''}>10:00-13:00</option>
                                    <option value="13:00-16:00" {$goods.activity_time == '13:00-16:00' ? 'selected' : ''}>13:00-16:00</option>
                                    <option value="16:00-19:00" {$goods.activity_time == '16:00-19:00' ? 'selected' : ''}>16:00-19:00</option>
                                </select>
                            </div>
                        </div>

                        <input type="hidden" value="{$goods_id}" name="goods_id">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('goodsEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Miaoshagoods/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            });

        });
        var laydate = layui.laydate;
        //同时绑定多个
        lay('.test-item').each(function(){
            laydate.render({
                elem: this
                ,format:'yyyy-MM-dd'
                ,type:'date'
                ,trigger: 'click'
            });
        });
    });
</script>

</body>
</html>
